< previous page page_514 next page >

Page 514
In the Form_Activate() event, all you have to do is check the ListCount property of the list box. If the count is equal to 0, you know that there are no employees in the table. In this case, you display a message box asking the user whether he or she wants to add some employees. If the user clicks Yes, you can invoke the cmdNew_Click() event to put the user into Add mode. If the user clicks No, you can unload the form.
Summary
Creating a data entry form using ADO instead of the data control takes a little more code, but its a little easier to follow the flow as opposed to all the different events you have to write code for when using the data control. Also, you have total control over how everything works instead of being locked into the data control paradigm.
Review Questions
1. What do you use the ItemData property for?
2. How do you delete a row using ADO?
Exercises
1. Create a program that loads the employee types from the tblEmpTypes table into a list box.
2. Add the capability to click an employee type and display the appropriate fields on the right side of the list box.
3. Add the capability to add/edit/delete employee types.

 
< previous page page_514 next page >

If you like this book, buy it!